package com.guoxin.chapter7.fromatok1;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MyThread extends Thread {
	private SimpleDateFormat sdf;
	private String dataString;

	public MyThread(SimpleDateFormat sdf, String dataString) {
		super();
		this.sdf = sdf;
		this.dataString = dataString;
	}

	@Override
	public void run() {
		try {
			Date dateRef = DateTools.parse("yyyy-MM-dd",dataString);
			String newDateString = DateTools.format("yyyy-MM-dd",dateRef).toString();
			if (!newDateString.equals(dataString)) {
				System.out.println(
						"ThreadName=" + this.getName() + " 报错了 日期字符串：" + dataString + " 转换成日期为：" + newDateString);
			}
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}
}
